package com.huawei.csi.tool.controller;

import com.huawei.csi.tool.config.constants.URLConstants;
import com.huawei.csi.tool.util.OSUtil;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;

import java.net.URL;
import java.util.ResourceBundle;

import static com.huawei.csi.tool.util.ResourcesUtil.message;

public class AboutAlertController {
    @FXML
    private ResourceBundle resources;
    @FXML
    private URL location;
    @FXML
    private Label bilibiliLabel;
    @FXML
    private VBox qqContactBox;
    @FXML
    private Label qqGroupLabel;
    @FXML
    private Label ddLabel;

    @FXML
    void initialize() {
        qqContactBox.setVisible(!OSUtil.isEnglish());
        qqContactBox.setManaged(!OSUtil.isEnglish());
    }

    @FXML
    void onClickBilibiliBtn(MouseEvent event) {
        OSUtil.showDoc(URLConstants.CJ_BILIBILI);
    }

    @FXML
    void onClickCangJieBtn(MouseEvent event) {
        OSUtil.showDoc(URLConstants.CJ_LEARN);
    }

    @FXML
    void onClickCheckUpdateButton(MouseEvent event) {

    }

    @FXML
    void onClickCopyDd(MouseEvent event) {
        OSUtil.writeToClipboard(ddLabel.getText().trim());

    }

    @FXML
    void onClickCopyQQGroup(MouseEvent event) {
        OSUtil.writeToClipboard(qqGroupLabel.getText().trim());
    }


    @FXML
    void onClickGiteeBtn(MouseEvent event) {
        OSUtil.showDoc(URLConstants.CJ_TOOL_CODE_SOURCE);
    }

    @FXML
    void onClickGithubBtn(MouseEvent event) {
        OSUtil.showDoc(URLConstants.CJ_TPC_CODE);
    }

    @FXML
    void onClickHelpBtn(MouseEvent event) {
        OSUtil.showDoc(message("about.helpUrl"));
    }


}
